
<%@ include file="/common/taglibs.jsp"%>
<!--分页查询共用的页面-->
<%@ include file="/common/common.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<script type="text/javascript" src="<%=jsPath%>/jquery/jquery.timers.js"></script><!--定时器-->
<script type="text/javascript" src="<%=jsPath%>/terminalCommand.js"></script><!--终端命令结果查询-->
<script type="text/javascript" src="<%=jsPath%>/videoPlayer.js"></script><!--终端命令结果查询-->


<script>
	/*
	修改代码：
	1.新定义变量TerminalCommmand，为命令支持变量
	2.重定义id：
	原：null		现：videoControlCommandMsg
	原：null		现：videoControlBtn
	原：		现：
	*/

	var tc2VideoControl = new TerminalCommand2();
    var timerName = "videoControlTimer";
    ///////////////////////////////////////////////////////////////
    tc2VideoControl.messageDiv = $("#videoControlCommandMsg");
	tc2VideoControl.timerName = timerName;
	tc2VideoControl.commandButton = $("#videoControlBtn");

    function onCommandSuccess()
	{
	}


$().ready(function() {
	 $("#videoControlentityForm").validate(); //初始化验证信息

    var defaultChannelId = "1";//默认选中
    $("#channelId").fillVehicleChannels({vehicleId:"${vehicleId}",selectedValue:defaultChannelId});
	 var defaultRoleId = "";//${roleId}; //取出当前车辆的车牌颜色，默认选中
	//ajax填充下拉框数据 填充监听类型 选项
	 //$("#listenType").lookup({category:"ListenTerminal", selectedValue:1});
	  Utility.ajaxSubmitForm("videoControlentityForm", {
						 success:function(responseText)
						 {
							   var result = responseText;
								if (result.success) {
									 var commandId = result.data; //下发成功后，获取到命令Id
									 tc2VideoControl.startQueryResult(commandId,null,onCommandSuccess);//命令下发成功,根据命令id,开始尝试获取检索结果
								}
								else {
									$("#videoControlCommandMsg").html("提交失败! 错误原因：" + (result.message ? result.message : result.Data));
									//停止所有的在$('body')上定时器  
									$('#videoControlBody').stopTime (timerName);  
								  }
						 }
	 });
});
</script>
 <BODY id="videoControlBody">
	<form id="videoControlentityForm" name="videoControlentityForm" 
			action='<%=ApplicationPath%>/videoCommand/controlRealPlayVideo.action' method="POST">
				
        <input type="hidden"  name="vehicleId"  id="vehicleId" value="${vehicleId}"/>
		<input type="hidden"  name="simNo"  id="simNo" value="${simNo}"/>
  <table width="100%"  class="TableBlock">
					<tbody><tr>
						<td colspan="2" style="font-weight: bold; background: #EFEFEF;" height="25">监听信息
						<span style="color:red;background:blue;">${message}</span>
						</td>
					</tr>

					<tr>
						<td align="right">通道
							:</td>
						<td>
							<select id="channelId" name="channelId">
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">控制指令
						:</td>
						<td>
							<select id="controlCmd" name="controlCmd">
								<option value="0">关闭音视频传输指令</option>
								<option value="1">切换码流</option>
								<option value="2">暂停该通道所有发送</option>
								<option value="3">恢复暂停流的发送</option>
								<option value="4">关闭双向对讲</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">关闭音视频类型
							:</td>
						<td>
							<select id="videoDataType" name="videoDataType">
								<option value="0">关闭该通道有关的音视频数据</option>
								<option value="1">只关闭该通道有关的音频，保留该通道有关的视频</option>
								<option value="2">只关闭该通道有关的视频，保留该通道有关的音频</option>
							</select>
						</td>
					</tr>

					<tr>
						<td align="right">申请切换的码流
							:</td>
						<td>
							<select id="streamType" name="streamType">
								<option value="0">主码流</option>
								<option value="1">子码流</option>
							</select>
						</td>
					</tr>
					<tr>


						<td colspan=2 align="center">
						   <input id="videoControlBtn" type="submit" class="sendjson" value="下发控制指令">
						   <span id="videoControlCommandMsg" class="commandMsg"></span></td>
						
					</tr>

				
					
				</tbody></table>
				</form>
 </BODY>
</HTML>
